package BinarySearch;

import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }

        Arrays.sort(nums);
        int[] arr = new int[n];
        arr[0] = nums[0];
        for (int i = 1; i < n; i++) {
            arr[i] = arr[i - 1] + nums[i];
        }

        int move = sc.nextInt();
        int sum = 0;
        binarySearch b = new binarySearch();
        for (int i = 0; i < move; i++) {
            int x = sc.nextInt();
            sum += x;
            if (nums[0] >= 0 && sum >= 0) {
                System.out.println(arr[n - 1] + sum * n);
                continue;
            }
            if (nums[n - 1] + sum <= 0 && sum >= 0) {
                System.out.println(-arr[n - 1] - sum * n);
                continue;
            }
            if (nums[n - 1] <= 0 && sum <= 0) {
                System.out.println(-arr[n - 1] - sum * n);
                continue;
            }

            if (sum >= 0) {
                int idx = b.searchFirstEqualOrLarger(nums, -sum);
            }




        }
    }
}
